<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActiveRecord::ConnectionAdapters::SchemaStatements</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActiveRecord::ConnectionAdapters::SchemaStatements</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements_rb.html">
                vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M001423">add_column</a>&nbsp;&nbsp;
      <a href="#M001429">add_index</a>&nbsp;&nbsp;
      <a href="#M001435">add_order_by_for_association_limiting!</a>&nbsp;&nbsp;
      <a href="#M001436">add_timestamps</a>&nbsp;&nbsp;
      <a href="#M001433">assume_migrated_upto_version</a>&nbsp;&nbsp;
      <a href="#M001426">change_column</a>&nbsp;&nbsp;
      <a href="#M001427">change_column_default</a>&nbsp;&nbsp;
      <a href="#M001420">change_table</a>&nbsp;&nbsp;
      <a href="#M001418">columns</a>&nbsp;&nbsp;
      <a href="#M001419">create_table</a>&nbsp;&nbsp;
      <a href="#M001434">distinct</a>&nbsp;&nbsp;
      <a href="#M001422">drop_table</a>&nbsp;&nbsp;
      <a href="#M001432">initialize_schema_migrations_table</a>&nbsp;&nbsp;
      <a href="#M001414">native_database_types</a>&nbsp;&nbsp;
      <a href="#M001438">options_include_default?</a>&nbsp;&nbsp;
      <a href="#M001424">remove_column</a>&nbsp;&nbsp;
      <a href="#M001425">remove_columns</a>&nbsp;&nbsp;
      <a href="#M001430">remove_index</a>&nbsp;&nbsp;
      <a href="#M001437">remove_timestamps</a>&nbsp;&nbsp;
      <a href="#M001428">rename_column</a>&nbsp;&nbsp;
      <a href="#M001421">rename_table</a>&nbsp;&nbsp;
      <a href="#M001431">structure_dump</a>&nbsp;&nbsp;
      <a href="#M001416">table_alias_for</a>&nbsp;&nbsp;
      <a href="#M001415">table_alias_length</a>&nbsp;&nbsp;
      <a href="#M001417">table_exists?</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M001423" class="method-detail">
        <a name="M001423"></a>

        <div class="method-heading">
          <a href="#M001423" class="method-signature">
          <span class="method-name">add_column</span><span class="method-args">(table_name, column_name, type, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Adds a new column to the named table. See <a
href="TableDefinition.html#M001480">TableDefinition#column</a> for details
of the options you can use.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001423-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001423-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 192</span>
192:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_column</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">options</span> = {})
193:         <span class="ruby-identifier">add_column_sql</span> = <span class="ruby-node">&quot;ALTER TABLE #{quote_table_name(table_name)} ADD #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}&quot;</span>
194:         <span class="ruby-identifier">add_column_options!</span>(<span class="ruby-identifier">add_column_sql</span>, <span class="ruby-identifier">options</span>)
195:         <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">add_column_sql</span>)
196:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001429" class="method-detail">
        <a name="M001429"></a>

        <div class="method-heading">
          <a href="#M001429" class="method-signature">
          <span class="method-name">add_index</span><span class="method-args">(table_name, column_name, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Adds a new index to the table. <tt>column_name</tt> can be a single Symbol,
or an Array of Symbols.
</p>
<p>
The index will be named after the table and the first column name, unless
you pass <tt>:name</tt> as an option.
</p>
<p>
When creating an index on multiple <a
href="SchemaStatements.html#M001418">columns</a>, the first column is used
as a name for the index. For example, when you specify an index on two <a
href="SchemaStatements.html#M001418">columns</a> [<tt>:first</tt>,
<tt>:last</tt>], the DBMS creates an index for both <a
href="SchemaStatements.html#M001418">columns</a> as well as an index for
the first column <tt>:first</tt>. Using just the first name for this index
makes sense, because you will never have to create a singular index with
this name.
</p>
<h5>Examples</h5>
<h6>Creating a simple index</h6>
<pre>
 add_index(:suppliers, :name)
</pre>
<p>
generates
</p>
<pre>
 CREATE INDEX suppliers_name_index ON suppliers(name)
</pre>
<h6>Creating a unique index</h6>
<pre>
 add_index(:accounts, [:branch_id, :party_id], :unique =&gt; true)
</pre>
<p>
generates
</p>
<pre>
 CREATE UNIQUE INDEX accounts_branch_id_party_id_index ON accounts(branch_id, party_id)
</pre>
<h6>Creating a named index</h6>
<pre>
 add_index(:accounts, [:branch_id, :party_id], :unique =&gt; true, :name =&gt; 'by_branch_party')
</pre>
<p>
generates
</p>
<pre>
 CREATE UNIQUE INDEX by_branch_party ON accounts(branch_id, party_id)
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001429-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001429-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 261</span>
261:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_index</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">options</span> = {})
262:         <span class="ruby-identifier">column_names</span> = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">column_name</span>)
263:         <span class="ruby-identifier">index_name</span>   = <span class="ruby-identifier">index_name</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">:column</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">column_names</span>)
264: 
265:         <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">options</span> <span class="ruby-comment cmt"># legacy support, since this param was a string</span>
266:           <span class="ruby-identifier">index_type</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:unique</span>] <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;UNIQUE&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;&quot;</span>
267:           <span class="ruby-identifier">index_name</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:name</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">index_name</span>
268:         <span class="ruby-keyword kw">else</span>
269:           <span class="ruby-identifier">index_type</span> = <span class="ruby-identifier">options</span>
270:         <span class="ruby-keyword kw">end</span>
271:         <span class="ruby-identifier">quoted_column_names</span> = <span class="ruby-identifier">column_names</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">quote_column_name</span>(<span class="ruby-identifier">e</span>) }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;, &quot;</span>)
272:         <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;CREATE #{index_type} INDEX #{quote_column_name(index_name)} ON #{quote_table_name(table_name)} (#{quoted_column_names})&quot;</span>
273:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001435" class="method-detail">
        <a name="M001435"></a>

        <div class="method-heading">
          <a href="#M001435" class="method-signature">
          <span class="method-name">add_order_by_for_association_limiting!</span><span class="method-args">(sql, options)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
ORDER BY clause for the passed order option. PostgreSQL overrides this due
to its stricter standards compliance.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001435-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001435-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 408</span>
408:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_order_by_for_association_limiting!</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-identifier">options</span>)
409:         <span class="ruby-identifier">sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; ORDER BY #{options[:order]}&quot;</span>
410:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001436" class="method-detail">
        <a name="M001436"></a>

        <div class="method-heading">
          <a href="#M001436" class="method-signature">
          <span class="method-name">add_timestamps</span><span class="method-args">(table_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Adds timestamps (created_at and updated_at) <a
href="SchemaStatements.html#M001418">columns</a> to the named table.
</p>
<h5>Examples</h5>
<pre>
 add_timestamps(:suppliers)
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001436-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001436-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 415</span>
415:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_timestamps</span>(<span class="ruby-identifier">table_name</span>)
416:         <span class="ruby-identifier">add_column</span> <span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">:created_at</span>, <span class="ruby-identifier">:datetime</span>
417:         <span class="ruby-identifier">add_column</span> <span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">:updated_at</span>, <span class="ruby-identifier">:datetime</span>
418:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001433" class="method-detail">
        <a name="M001433"></a>

        <div class="method-heading">
          <a href="#M001433" class="method-signature">
          <span class="method-name">assume_migrated_upto_version</span><span class="method-args">(version)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001433-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001433-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 339</span>
339:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assume_migrated_upto_version</span>(<span class="ruby-identifier">version</span>)
340:         <span class="ruby-identifier">version</span> = <span class="ruby-identifier">version</span>.<span class="ruby-identifier">to_i</span>
341:         <span class="ruby-identifier">sm_table</span> = <span class="ruby-identifier">quote_table_name</span>(<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Migrator</span>.<span class="ruby-identifier">schema_migrations_table_name</span>)
342: 
343:         <span class="ruby-identifier">migrated</span> = <span class="ruby-identifier">select_values</span>(<span class="ruby-node">&quot;SELECT version FROM #{sm_table}&quot;</span>).<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">:to_i</span>)
344:         <span class="ruby-identifier">versions</span> = <span class="ruby-constant">Dir</span>[<span class="ruby-value str">'db/migrate/[0-9]*_*.rb'</span>].<span class="ruby-identifier">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">filename</span><span class="ruby-operator">|</span>
345:           <span class="ruby-identifier">filename</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'/'</span>).<span class="ruby-identifier">last</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'_'</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_i</span>
346:         <span class="ruby-keyword kw">end</span>
347: 
348:         <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">migrated</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">version</span>)
349:           <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;INSERT INTO #{sm_table} (version) VALUES ('#{version}')&quot;</span>
350:         <span class="ruby-keyword kw">end</span>
351: 
352:         <span class="ruby-identifier">inserted</span> = <span class="ruby-constant">Set</span>.<span class="ruby-identifier">new</span>
353:         (<span class="ruby-identifier">versions</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">migrated</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
354:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">inserted</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">v</span>)
355:             <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Duplicate migration #{v}. Please renumber your migrations to resolve the conflict.&quot;</span>
356:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">version</span>
357:             <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;INSERT INTO #{sm_table} (version) VALUES ('#{v}')&quot;</span>
358:             <span class="ruby-identifier">inserted</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">v</span>
359:           <span class="ruby-keyword kw">end</span>
360:         <span class="ruby-keyword kw">end</span>
361:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001426" class="method-detail">
        <a name="M001426"></a>

        <div class="method-heading">
          <a href="#M001426" class="method-signature">
          <span class="method-name">change_column</span><span class="method-args">(table_name, column_name, type, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Changes the column&#8216;s definition according to the new options. See <a
href="TableDefinition.html#M001480">TableDefinition#column</a> for details
of the options you can use.
</p>
<h5>Examples</h5>
<pre>
 change_column(:suppliers, :name, :string, :limit =&gt; 80)
 change_column(:accounts, :description, :text)
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001426-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001426-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 214</span>
214:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">change_column</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">options</span> = {})
215:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-value str">&quot;change_column is not implemented&quot;</span>
216:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001427" class="method-detail">
        <a name="M001427"></a>

        <div class="method-heading">
          <a href="#M001427" class="method-signature">
          <span class="method-name">change_column_default</span><span class="method-args">(table_name, column_name, default)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sets a new default value for a column. If you want to set the default value
to <tt>NULL</tt>, you are out of luck. You need to <a
href="DatabaseStatements.html#M001392">DatabaseStatements#execute</a> the
appropriate SQL statement yourself.
</p>
<h5>Examples</h5>
<pre>
 change_column_default(:suppliers, :qualification, 'new')
 change_column_default(:accounts, :authorized, 1)
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001427-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001427-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 224</span>
224:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">change_column_default</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">default</span>)
225:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-value str">&quot;change_column_default is not implemented&quot;</span>
226:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001420" class="method-detail">
        <a name="M001420"></a>

        <div class="method-heading">
          <a href="#M001420" class="method-signature">
          <span class="method-name">change_table</span><span class="method-args">(table_name) {|Table.new(table_name, self)| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
A block for changing <a href="SchemaStatements.html#M001418">columns</a> in
<tt>table</tt>.
</p>
<h3>Example</h3>
<pre>
 # change_table() yields a Table instance
 change_table(:suppliers) do |t|
   t.column :name, :string, :limit =&gt; 60
   # Other column alterations here
 end
</pre>
<h5>Examples</h5>
<h6>Add a column</h6>
<pre>
 change_table(:suppliers) do |t|
   t.column :name, :string, :limit =&gt; 60
 end
</pre>
<h6>Add 2 integer <a href="SchemaStatements.html#M001418">columns</a></h6>
<pre>
 change_table(:suppliers) do |t|
   t.integer :width, :height, :null =&gt; false, :default =&gt; 0
 end
</pre>
<h6>Add created_at/updated_at <a href="SchemaStatements.html#M001418">columns</a></h6>
<pre>
 change_table(:suppliers) do |t|
   t.timestamps
 end
</pre>
<h6>Add a foreign key column</h6>
<pre>
 change_table(:suppliers) do |t|
   t.references :company
 end
</pre>
<p>
Creates a <tt>company_id(integer)</tt> column
</p>
<h6>Add a polymorphic foreign key column</h6>
<pre>
 change_table(:suppliers) do |t|
   t.belongs_to :company, :polymorphic =&gt; true
 end
</pre>
<p>
Creates <tt>company_type(varchar)</tt> and <tt>company_id(integer)</tt> <a
href="SchemaStatements.html#M001418">columns</a>
</p>
<h6>Remove a column</h6>
<pre>
 change_table(:suppliers) do |t|
   t.remove :company
 end
</pre>
<h6>Remove several <a href="SchemaStatements.html#M001418">columns</a></h6>
<pre>
 change_table(:suppliers) do |t|
   t.remove :company_id
   t.remove :width, :height
 end
</pre>
<h6>Remove an index</h6>
<pre>
 change_table(:suppliers) do |t|
   t.remove_index :company_id
 end
</pre>
<p>
See also <a href="Table.html">Table</a> for details on all of the various
column transformation
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001420-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001420-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 174</span>
174:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">change_table</span>(<span class="ruby-identifier">table_name</span>)
175:         <span class="ruby-keyword kw">yield</span> <span class="ruby-constant">Table</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-keyword kw">self</span>)
176:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001418" class="method-detail">
        <a name="M001418"></a>

        <div class="method-heading">
          <a href="#M001418" class="method-signature">
          <span class="method-name">columns</span><span class="method-args">(table_name, name = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns an array of <a href="Column.html">Column</a> objects for the table
specified by <tt>table_name</tt>. See the concrete implementation for
details on the expected parameter values.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001418-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001418-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 32</span>
32:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">columns</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">nil</span>) <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001419" class="method-detail">
        <a name="M001419"></a>

        <div class="method-heading">
          <a href="#M001419" class="method-signature">
          <span class="method-name">create_table</span><span class="method-args">(table_name, options = {}) {|table_definition| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates a new table with the name <tt>table_name</tt>. <tt>table_name</tt>
may either be a String or a Symbol.
</p>
<p>
There are two ways to work with <tt><a
href="SchemaStatements.html#M001419">create_table</a></tt>. You can use the
block form or the regular form, like this:
</p>
<h3>Block form</h3>
<pre>
 # create_table() passes a TableDefinition object to the block.
 # This form will not only create the table, but also columns for the
 # table.
 create_table(:suppliers) do |t|
   t.column :name, :string, :limit =&gt; 60
   # Other fields here
 end
</pre>
<h3>Regular form</h3>
<pre>
 # Creates a table called 'suppliers' with no columns.
 create_table(:suppliers)
 # Add a column to 'suppliers'.
 add_column(:suppliers, :name, :string, {:limit =&gt; 60})
</pre>
<p>
The <tt>options</tt> hash can include the following keys:
</p>
<dl>
<dt><tt>:id</tt></dt><dd>Whether to automatically add a primary key column. Defaults to true. Join
tables for <tt>has_and_belongs_to_many</tt> should set <tt>:id =&gt;
false</tt>.

</dd>
<dt><tt>:primary_key</tt></dt><dd>The name of the primary key, if one is to be added automatically. Defaults
to <tt>id</tt>.

</dd>
<dt><tt>:options</tt></dt><dd>Any extra options you want appended to the table definition.

</dd>
<dt><tt>:temporary</tt></dt><dd>Make a temporary table.

</dd>
<dt><tt>:force</tt></dt><dd>Set to true to drop the table before creating it. Defaults to false.

</dd>
</dl>
<h5>Examples</h5>
<h6>Add a backend specific option to the generated SQL (MySQL)</h6>
<pre>
 create_table(:suppliers, :options =&gt; 'ENGINE=InnoDB DEFAULT CHARSET=utf8')
</pre>
<p>
generates:
</p>
<pre>
 CREATE TABLE suppliers (
   id int(11) DEFAULT NULL auto_increment PRIMARY KEY
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
</pre>
<h6>Rename the primary key column</h6>
<pre>
 create_table(:objects, :primary_key =&gt; 'guid') do |t|
   t.column :name, :string, :limit =&gt; 80
 end
</pre>
<p>
generates:
</p>
<pre>
 CREATE TABLE objects (
   guid int(11) DEFAULT NULL auto_increment PRIMARY KEY,
   name varchar(80)
 )
</pre>
<h6>Do not add a primary key column</h6>
<pre>
 create_table(:categories_suppliers, :id =&gt; false) do |t|
   t.column :category_id, :integer
   t.column :supplier_id, :integer
 end
</pre>
<p>
generates:
</p>
<pre>
 CREATE TABLE categories_suppliers (
   category_id int,
   supplier_id int
 )
</pre>
<p>
See also <a href="TableDefinition.html#M001480">TableDefinition#column</a>
for details on how to create <a
href="SchemaStatements.html#M001418">columns</a>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001419-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001419-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 100</span>
100:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_table</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">options</span> = {})
101:         <span class="ruby-identifier">table_definition</span> = <span class="ruby-constant">TableDefinition</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
102:         <span class="ruby-identifier">table_definition</span>.<span class="ruby-identifier">primary_key</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:primary_key</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Base</span>.<span class="ruby-identifier">get_primary_key</span>(<span class="ruby-identifier">table_name</span>)) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:id</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
103: 
104:         <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">table_definition</span>
105: 
106:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:force</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">table_exists?</span>(<span class="ruby-identifier">table_name</span>)
107:           <span class="ruby-identifier">drop_table</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">options</span>)
108:         <span class="ruby-keyword kw">end</span>
109: 
110:         <span class="ruby-identifier">create_sql</span> = <span class="ruby-node">&quot;CREATE#{' TEMPORARY' if options[:temporary]} TABLE &quot;</span>
111:         <span class="ruby-identifier">create_sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{quote_table_name(table_name)} (&quot;</span>
112:         <span class="ruby-identifier">create_sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">table_definition</span>.<span class="ruby-identifier">to_sql</span>
113:         <span class="ruby-identifier">create_sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;) #{options[:options]}&quot;</span>
114:         <span class="ruby-identifier">execute</span> <span class="ruby-identifier">create_sql</span>
115:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001434" class="method-detail">
        <a name="M001434"></a>

        <div class="method-heading">
          <a href="#M001434" class="method-signature">
          <span class="method-name">distinct</span><span class="method-args">(columns, order_by)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
SELECT DISTINCT clause for a given set of <a
href="SchemaStatements.html#M001418">columns</a> and a given ORDER BY
clause. Both PostgreSQL and Oracle overrides this for custom DISTINCT
syntax.
</p>
<pre>
  distinct(&quot;posts.id&quot;, &quot;posts.created_at desc&quot;)
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001434-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001434-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 402</span>
402:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">distinct</span>(<span class="ruby-identifier">columns</span>, <span class="ruby-identifier">order_by</span>)
403:         <span class="ruby-node">&quot;DISTINCT #{columns}&quot;</span>
404:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001422" class="method-detail">
        <a name="M001422"></a>

        <div class="method-heading">
          <a href="#M001422" class="method-signature">
          <span class="method-name">drop_table</span><span class="method-args">(table_name, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Drops a table from the database.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001422-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001422-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 186</span>
186:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">drop_table</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">options</span> = {})
187:         <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;DROP TABLE #{quote_table_name(table_name)}&quot;</span>
188:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001432" class="method-detail">
        <a name="M001432"></a>

        <div class="method-heading">
          <a href="#M001432" class="method-signature">
          <span class="method-name">initialize_schema_migrations_table</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Should not be called normally, but this operation is non-destructive. The
migrations module handles this automatically.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001432-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001432-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 316</span>
316:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_schema_migrations_table</span>
317:         <span class="ruby-identifier">sm_table</span> = <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Migrator</span>.<span class="ruby-identifier">schema_migrations_table_name</span>
318: 
319:         <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">tables</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">sm_table</span> }
320:           <span class="ruby-identifier">create_table</span>(<span class="ruby-identifier">sm_table</span>, <span class="ruby-identifier">:id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">schema_migrations_table</span><span class="ruby-operator">|</span>
321:             <span class="ruby-identifier">schema_migrations_table</span>.<span class="ruby-identifier">column</span> <span class="ruby-identifier">:version</span>, <span class="ruby-identifier">:string</span>, <span class="ruby-identifier">:null</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>
322:           <span class="ruby-keyword kw">end</span>
323:           <span class="ruby-identifier">add_index</span> <span class="ruby-identifier">sm_table</span>, <span class="ruby-identifier">:version</span>, <span class="ruby-identifier">:unique</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
324:             <span class="ruby-identifier">:name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'unique_schema_migrations'</span>
325: 
326:           <span class="ruby-comment cmt"># Backwards-compatibility: if we find schema_info, assume we've</span>
327:           <span class="ruby-comment cmt"># migrated up to that point:</span>
328:           <span class="ruby-identifier">si_table</span> = <span class="ruby-constant">Base</span>.<span class="ruby-identifier">table_name_prefix</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'schema_info'</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Base</span>.<span class="ruby-identifier">table_name_suffix</span>
329: 
330:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tables</span>.<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">si_table</span> }
331: 
332:             <span class="ruby-identifier">old_version</span> = <span class="ruby-identifier">select_value</span>(<span class="ruby-node">&quot;SELECT version FROM #{quote_table_name(si_table)}&quot;</span>).<span class="ruby-identifier">to_i</span>
333:             <span class="ruby-identifier">assume_migrated_upto_version</span>(<span class="ruby-identifier">old_version</span>)
334:             <span class="ruby-identifier">drop_table</span>(<span class="ruby-identifier">si_table</span>)
335:           <span class="ruby-keyword kw">end</span>
336:         <span class="ruby-keyword kw">end</span>
337:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001414" class="method-detail">
        <a name="M001414"></a>

        <div class="method-heading">
          <a href="#M001414" class="method-signature">
          <span class="method-name">native_database_types</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns a Hash of mappings from the abstract data types to the native
database types. See <a
href="TableDefinition.html#M001480">TableDefinition#column</a> for details
on the recognized abstract data types.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001414-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001414-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 7</span>
7:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">native_database_types</span>
8:         {}
9:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001424" class="method-detail">
        <a name="M001424"></a>

        <div class="method-heading">
          <a href="#M001424" class="method-signature">
          <span class="method-name">remove_column</span><span class="method-args">(table_name, *column_names)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Removes the column(s) from the table definition.
</p>
<h5>Examples</h5>
<pre>
 remove_column(:suppliers, :qualification)
 remove_columns(:suppliers, :qualification, :experience)
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001424-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001424-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 202</span>
202:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_column</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">column_names</span>)
203:         <span class="ruby-identifier">column_names</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column_name</span><span class="ruby-operator">|</span>
204:           <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;ALTER TABLE #{quote_table_name(table_name)} DROP #{quote_column_name(column_name)}&quot;</span>
205:         <span class="ruby-keyword kw">end</span>
206:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001425" class="method-detail">
        <a name="M001425"></a>

        <div class="method-heading">
          <span class="method-name">remove_columns</span><span class="method-args">(table_name, *column_names)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="SchemaStatements.html#M001424">remove_column</a>
</p>
        </div>
      </div>

      <div id="method-M001430" class="method-detail">
        <a name="M001430"></a>

        <div class="method-heading">
          <a href="#M001430" class="method-signature">
          <span class="method-name">remove_index</span><span class="method-args">(table_name, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Remove the given index from the table.
</p>
<p>
Remove the suppliers_name_index in the suppliers table.
</p>
<pre>
  remove_index :suppliers, :name
</pre>
<p>
Remove the index named accounts_branch_id_index in the accounts table.
</p>
<pre>
  remove_index :accounts, :column =&gt; :branch_id
</pre>
<p>
Remove the index named accounts_branch_id_party_id_index in the accounts
table.
</p>
<pre>
  remove_index :accounts, :column =&gt; [:branch_id, :party_id]
</pre>
<p>
Remove the index named by_branch_party in the accounts table.
</p>
<pre>
  remove_index :accounts, :name =&gt; :by_branch_party
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001430-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001430-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 285</span>
285:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_index</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">options</span> = {})
286:         <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;DROP INDEX #{quote_column_name(index_name(table_name, options))} ON #{table_name}&quot;</span>
287:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001437" class="method-detail">
        <a name="M001437"></a>

        <div class="method-heading">
          <a href="#M001437" class="method-signature">
          <span class="method-name">remove_timestamps</span><span class="method-args">(table_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Removes the timestamp <a href="SchemaStatements.html#M001418">columns</a>
(created_at and updated_at) from the table definition.
</p>
<h5>Examples</h5>
<pre>
 remove_timestamps(:suppliers)
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001437-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001437-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 423</span>
423:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_timestamps</span>(<span class="ruby-identifier">table_name</span>)
424:         <span class="ruby-identifier">remove_column</span> <span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">:updated_at</span>
425:         <span class="ruby-identifier">remove_column</span> <span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">:created_at</span>
426:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001428" class="method-detail">
        <a name="M001428"></a>

        <div class="method-heading">
          <a href="#M001428" class="method-signature">
          <span class="method-name">rename_column</span><span class="method-args">(table_name, column_name, new_column_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Renames a column.
</p>
<h5>Example</h5>
<pre>
 rename_column(:suppliers, :description, :name)
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001428-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001428-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 231</span>
231:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rename_column</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">new_column_name</span>)
232:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-value str">&quot;rename_column is not implemented&quot;</span>
233:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001421" class="method-detail">
        <a name="M001421"></a>

        <div class="method-heading">
          <a href="#M001421" class="method-signature">
          <span class="method-name">rename_table</span><span class="method-args">(table_name, new_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Renames a table.
</p>
<h5>Example</h5>
<pre>
 rename_table('octopuses', 'octopi')
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001421-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001421-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 181</span>
181:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rename_table</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">new_name</span>)
182:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-value str">&quot;rename_table is not implemented&quot;</span>
183:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001431" class="method-detail">
        <a name="M001431"></a>

        <div class="method-heading">
          <a href="#M001431" class="method-signature">
          <span class="method-name">structure_dump</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns a string of <tt>CREATE TABLE</tt> SQL statement(s) for recreating
the entire structure of the database.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001431-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001431-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 305</span>
305:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">structure_dump</span>
306:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001416" class="method-detail">
        <a name="M001416"></a>

        <div class="method-heading">
          <a href="#M001416" class="method-signature">
          <span class="method-name">table_alias_for</span><span class="method-args">(table_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Truncates a table alias according to the limits of the current adapter.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001416-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001416-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 17</span>
17:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">table_alias_for</span>(<span class="ruby-identifier">table_name</span>)
18:         <span class="ruby-identifier">table_name</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">table_alias_length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>].<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\./</span>, <span class="ruby-value str">'_'</span>)
19:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001415" class="method-detail">
        <a name="M001415"></a>

        <div class="method-heading">
          <a href="#M001415" class="method-signature">
          <span class="method-name">table_alias_length</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This is the maximum length a table alias can be
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001415-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001415-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 12</span>
12:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">table_alias_length</span>
13:         <span class="ruby-value">255</span>
14:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001417" class="method-detail">
        <a name="M001417"></a>

        <div class="method-heading">
          <a href="#M001417" class="method-signature">
          <span class="method-name">table_exists?</span><span class="method-args">(table_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
def tables(name = nil) end
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001417-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001417-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 23</span>
23:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">table_exists?</span>(<span class="ruby-identifier">table_name</span>)
24:         <span class="ruby-identifier">tables</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">table_name</span>.<span class="ruby-identifier">to_s</span>)
25:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M001438" class="method-detail">
        <a name="M001438"></a>

        <div class="method-heading">
          <a href="#M001438" class="method-signature">
          <span class="method-name">options_include_default?</span><span class="method-args">(options)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001438-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001438-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb, line 429</span>
429:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">options_include_default?</span>(<span class="ruby-identifier">options</span>)
430:           <span class="ruby-identifier">options</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:default</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:null</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:default</span>].<span class="ruby-identifier">nil?</span>)
431:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>